﻿<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">
 
    <script type='text/html' template> 
        <input type='hidden' name='PID' value="{{ d.params.PID || '' }}"/>
    </script>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>标题</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' readonly='readonly' name='Title' value='{{ d.params.Title || '' }}' lay-verify='required' placeholder='标题' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div> 
    <div class='layui-form-item'>
        <label class='layui-form-label'>图片</label>
        <div class='layui-input-inline'>
            <script type='text/html' template lay-done='layui.data.setUpload(d);'>
                <input type='text' readonly='readonly' name='Logo_Upload' id='Logo_Upload' value='{{ d.params.Logo_Upload || '' }}' lay-verify='required' placeholder='请上传图片' autocomplete='off' class='layui-input'>
            </script>
        </div>
        <div class='layui-input-inline layui-btn-container' style='width: auto;'>
            <button class='layui-btn layui-btn-primary' layadmin-event='Logo_UploadImg'>查看图片</button>
        </div>
    </div>
     
    <div class='layui-form-item'>
        <label class='layui-form-label'>跳转类型 </label>
        <div class='layui-input-block'>
            <div class='layui-input-inline'>
                <script type='text/html' template>
                    <select readonly='readonly' name='Type_Sel'>                      <option value='0' {{ d.params.Type_Sel == '0' ? 'selected' : '' }}>主题商品</option>                      <option value='1' {{ d.params.Type_Sel == '1' ? 'selected' : '' }}>商品详情</option>                      <option value='9' {{ d.params.Type_Sel == '9' ? 'selected' : '' }}>外部链接</option>
                    </select>
                </script> 
            </div>
        </div>
    </div>
       
    <div class='layui-form-item'>
        <label class='layui-form-label'>跳转地址 (存主题ID，商品ID，url)</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' readonly='readonly' name='DetailUrl' value='{{ d.params.DetailUrl || '' }}' lay-verify='required' placeholder='跳转地址 (存主题ID，商品ID，url)' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>开始时间</label>
        <div class='layui-input-inline'>
            <script type='text/html' template lay-done='layui.data.datedone(d.params);'>
                <input type='text' readonly='readonly' name='StartTime' readonly='readonly' id='StartTime' value='{{ d.params.StartTime || '' }}' lay-verify='datetime' placeholder='yyyy-MM-dd HH:mm:ss' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>
       
    <div class='layui-form-item'>
        <label class='layui-form-label'>结束时间</label>
        <div class='layui-input-inline'>
            <script type='text/html' template lay-done='layui.data.datedone(d.params);'>
                <input type='text' readonly='readonly' name='EndTime' readonly='readonly' id='EndTime' value='{{ d.params.EndTime || '' }}' lay-verify='datetime' placeholder='yyyy-MM-dd HH:mm:ss' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>
       
    <div class='layui-form-item'>
        <label class='layui-form-label'>描述</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' readonly='readonly' name='Description' value='{{ d.params.Description || '' }}' lay-verify='required' placeholder='描述' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>背景颜色</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' readonly='readonly' name='Color' value='{{ d.params.Color || '' }}' lay-verify='required' placeholder='背景颜色' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>店铺ID</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' readonly='readonly' name='StoreID' value='{{ d.params.StoreID || '' }}' lay-verify='required' placeholder='店铺ID' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div> 
    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-inline">
            <input type="button"  onclick="Close()" value="关闭" class="layui-btn">
        </div>
    </div>
</div>

<script type="text/javascript">  
    function Close(){
        layer.closeAll();
    }

    layui.use(['form','admin','upload'], function () {
        var form = layui.form;//required（必填项）phone（手机号）email（邮箱）url（网址）number（数字）date（日期）identity（身份证） 自定义值
    });
    
    
    layui.data.getSelSource = function (d,sourceName) { 
            var $ = layui.$;
            var form = layui.form;
            var admin = layui.admin;
 
    }
 
    
    layui.data.setUpload = function (d) { 
            var $ = layui.$,
            upload = layui.upload,
            admin = layui.admin;
            var formSelects = layui.formSelects;

            //上传头像
            var Logo_UploadSrc = $('#Logo_Upload');
            upload.render({
                url: '/file/uploadImg/'
              , elem: '#Logo_UploadBtn'
              , accept: 'images'
              , method: 'get'
              , multiple: true
              , acceptMime: 'image/*'
              , done: function (res) {
                  if (res.ResultCode == 0) {
                      Logo_UploadSrc.val(res.Data.src);
                      layer.msg('上传成功');
                  } else {
                      layer.msg(res.msg);
                  }
              }
            });

            //查看图片
            admin.events.Logo_UploadImg = function (othis) {
                var src = Logo_UploadSrc.val();
                layer.photos({
                    photos: {
                        "title": "查看头像" //相册标题 
                      , "data": [{
                       "src": src //原图地址
                      }]
                    }
                  , shade: 0.01
                  , closeBtn: 1
                  , anim: 5
                });
            };
 
    }

    
    layui.data.datedone = function (d) { 
            var laydate = layui.laydate;

            //日期时间选择器
            laydate.render({
                elem: '#StartTime'
              , type: 'datetime'
              , calendar: true
            });
            laydate.val = d.StartTime;

            //日期时间选择器
            laydate.render({
                elem: '#EndTime'
              , type: 'datetime'
              , calendar: true
            });
            laydate.val = d.EndTime;
 
    }
    
</script>
